package angels.client.Tasks;
import java.util.TimerTask;
import angels.client.Listeners.BlockingLocationListener;
import angels.client.Services.BusyHourService;
import android.content.Context;
import android.location.LocationManager;

public class GPSTask extends TimerTask {    
    private final BusyHourService service;
    private final BlockingLocationListener bll;
    
    public GPSTask(BusyHourService service) {
        this.service = service;
        LocationManager locMngr = (LocationManager) service.getSystemService(Context.LOCATION_SERVICE);
        bll = new BlockingLocationListener(locMngr);
    }
    
    @Override
    public void run() {
       service.myLocation = bll.blockingGetLocation(10000, 10); // wait for 10m accurate location read
    }
}